﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace KPIS.GERP.WEB.GAMS.Classes
{
	public static class WebConfigUtility
	{								 
		public static string GetAppSetting(string entryName)
		{
			try
			{
				return System.Configuration.ConfigurationManager.AppSettings[entryName];
			} catch(Exception ex)
			{
				throw ex;
			}
		}	 
		public static string GetConnectionString(string entryName)
		{
			try
			{
				return System.Configuration.ConfigurationManager.ConnectionStrings[entryName].ConnectionString;
			} catch(Exception ex)
			{
				throw ex;
			}
		}

		

		public static string ErrorLogWebGimsUrl
		{
			get { return GetAppSetting("ErrorLogWebGimsUrl"); }
		}

		public static string ErrorLogWcfEssUrl
		{
			get { return GetAppSetting("ErrorLogWcfEssUrl"); }
		}

		public static string ErrorLogWcfGbmsUrl
		{
			get { return GetAppSetting("ErrorLogWcfGbmsUrl"); }
		}

		public static string ErrorLogWcfGhrmsUrl
		{
			get { return GetAppSetting("ErrorLogWcfGhrmsUrl"); }
		}

		public static string ErrorLogWcfGimsUrl
		{
			get { return GetAppSetting("ErrorLogWcfGimsUrl"); }
		}

		public static string SiteMenuXml
		{
			get { return GetAppSetting("SiteMenuXml"); }
		}

		public static string LoginMainTitle
		{
			get { return GetAppSetting("LoginMainTitle"); }
		}

		public static string LoginSubTitle
		{
			get { return GetAppSetting("LoginSubTitle"); }
		}

		public static string LoginThirdTitle
		{
			get { return GetAppSetting("LoginThirdTitle"); }
		}

		public static string LoginLogoPath
		{
			get { return GetAppSetting("LoginLogoPath"); }
		}

		public static string SystemName
		{
			get { return GetAppSetting("SystemName"); }
		}

		public static string GERPContextConnectionString
		{
			get { return GetConnectionString("GERPContext"); }
		}

		public static bool CacheMenuInMemory
		{
			get { return ConvertOrDefault.StringToBool(GetAppSetting("CacheMenuInMemory")); }
		}
	}
}